require('./config/database')
const Koa = require('koa')
const bodyParser = require('koa-bodyparser');
const { APP_PORT } = require('./config/config');
const useRouter = require('./router/index');
const errorHandle = require('./utils/errorHandle');

const app = new Koa();

app.use(bodyParser());

//绑定路由
useRouter(app)

// 监听错误

app.on('error', errorHandle);


app.listen(APP_PORT, () => {
  console.log(`server run at ${APP_PORT}!`);
});